"""
torch.cat函数可以将两个张量根据指定的维度拼接起来，不改变维度数
语法：
    torch.cat([data1,data2],dim=n)  => 对n维度进行拼接
"""
import torch
import torch as t

data1 = t.randint(1, 100, [2, 3, 4])
data2 = t.randint(1, 100, [2, 3, 4])

print("=============拼接0维度==============")
data3 = torch.cat([data1, data2], dim=0)
print(data3)
print(data3.shape)

print("=============拼接1维度==============")
data3 = torch.cat([data1, data2], dim=1)
print(data3)
print(data3.shape)

print("=============拼接-1维度==============")
data3 = torch.cat([data1, data2], dim=-1)
print(data3)
print(data3.shape)
